import axios from 'axios'

export const getProductList = (current, size, productVo) => {
  return axios({
    url: '/api/product/getProductList',
    method: 'post',
    /*localhost:8080/user?id=  方式传值*/
    params: {
      current,
      size
    },
    /*json数据传值*/
    data: productVo
  })
}

export const findProductStocks = (current, size, productVo) => {
  return axios({
    url: '/api/product/findProductStocks',
    method: 'post',
    /*localhost:8080/user?id=  方式传值*/
    params: {
      current,
      size
    },
    /*json数据传值*/
    data: productVo
  })
}

export const findOutEnableStocks = (current, size, productVo) => {
  return axios({
    url: '/api/product/findOutEnableStocks',
    method: 'post',
    /*localhost:8080/user?id=  方式传值*/
    params: {
      current,
      size
    },
    /*json数据传值*/
    data: productVo
  })
}

/*添加物资*/
export const addProduct = (product) => {
  return axios({
    url: '/api/product/addProduct',
    method: 'post',
    data: product,
  })
}

/*修改物资*/
export const updateProduct = (product) => {
  return axios({
    url: '/api/product/updateProduct',
    method: 'post',
    data: product,
  })
}

/*删除物资*/
export const del = (id) => {
  return axios({
    url: '/api/product/delProduct',
    method: 'delete',
    params: {
      id
    }
  })
}

/*恢复物资*/
export const back = (id) => {
  return axios({
    url: '/api/product/backProduct',
    method: 'post',
    params: {
      id
    }
  })
}

/*移至回收站*/
export const remove = (id) => {
  return axios({
    url: '/api/product/removeProduct',
    method: 'post',
    params: {
      id
    }
  })
}

/*审核通过*/
export const publish = (id) => {
  return axios({
    url: '/api/product/publishProduct',
    method: 'post',
    params: {
      id
    }
  })
}
